package com.project.frame.common.config;

import com.project.frame.common.intercetor.AuthInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.DependsOn;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.util.ArrayList;
import java.util.List;

/**
 * desc
 *
 * @author lw007
 * @date 2021/12/23
 */
@Configuration
@DependsOn("authInterceptor")
public class WebMvcConfig implements WebMvcConfigurer {
    static List<String> pathPatternList = new ArrayList<>();
    static List<String> excludePathList = new ArrayList<>();
    static {
        pathPatternList.add("/**");

        excludePathList.add("/swagger**/**");
        excludePathList.add("/v3/**");
        excludePathList.add("/static/**");
        excludePathList.add("/views/**");
    }

    @Autowired
    AuthInterceptor authInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
//        registry.addInterceptor(authInterceptor).addPathPatterns("/");
//                .addPathPatterns(pathPatternList)
//                .excludePathPatterns(excludePathList);
    }
}
